home account info subscribe login search FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

Bug Proofing Visual Basic: A Guide to Error Handling and Prevention
(Publisher: John Wiley & Sons, Inc.)
Author(s): Rod Stephens
ISBN: 0471323519
Publication Date: 11/01/98

Search this book:
 
Previous Table of Contents Next


Summary

Visual Basic is safer than many programming languages, but it still has its share of traps for the unwary. The Bug Stoppers that follow summarize the guidelines for avoiding the traps that are discussed in this chapter.

BUG STOPPERS: Gotchas
Watch precision in tests.
Control float loops with while.
Control float loops with integers.
Control date loops with while loops or integers.
Don’t resize arrays or collections inside loops that access them.
Watch for circular object references.
Understand when forms load and unload.
Initialize all values.
Use every value you calculate or remove the calculation.
Make sure functions always define their return values.
Beware of using the syntax from other programming languages.
Never use GoTo except for error handling or to simplify code.
Never use GoTo to jump backwards in the code.
Never use GoTo to jump into a loop.
Exit in one place.
Place all error-handler code together at the end of the routine.
Use an Exit Sub statement before error handlers.
Do not use IIF, use If Then Else instead.
Watch for overflow and underflow.
Watch for divide-by-0 errors.
Use parentheses and data type conversion functions to control variable promotion.
Avoid functions that return status codes, but check them when you use such a function.
Use Len and LenB to determine variable sizes.
Do not assume constant values will never change.


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-1999 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permision of EarthWeb is prohibited.